/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.jomijushi.fid.dominio;

import java.io.Serializable;
import java.util.Date;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 *
 * @author miguel
 */
@Entity
@Table(name = "fid_item_venta", catalog = "fid", schema = "")
@NamedQueries({@NamedQuery(name = "FidItemVenta.findAll", query = "SELECT f FROM FidItemVenta f"), @NamedQuery(name = "FidItemVenta.findById", query = "SELECT f FROM FidItemVenta f WHERE f.id = :id"), @NamedQuery(name = "FidItemVenta.findByCant", query = "SELECT f FROM FidItemVenta f WHERE f.cant = :cant"), @NamedQuery(name = "FidItemVenta.findByOferta", query = "SELECT f FROM FidItemVenta f WHERE f.oferta = :oferta"), @NamedQuery(name = "FidItemVenta.findByTipo", query = "SELECT f FROM FidItemVenta f WHERE f.tipo = :tipo"), @NamedQuery(name = "FidItemVenta.findByCreatedAt", query = "SELECT f FROM FidItemVenta f WHERE f.createdAt = :createdAt"), @NamedQuery(name = "FidItemVenta.findByUpdatedAt", query = "SELECT f FROM FidItemVenta f WHERE f.updatedAt = :updatedAt")})
public class FidItemVenta implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id")
    private Integer id;
    @Column(name = "cant")
    private Integer cant;
    @Lob
    @Column(name = "descripcion")
    private String descripcion;
    @Column(name = "oferta")
    private Boolean oferta;
    @Column(name = "tipo")
    private String tipo;
    @Column(name = "created_at")
    @Temporal(TemporalType.TIMESTAMP)
    private Date createdAt;
    @Column(name = "updated_at")
    @Temporal(TemporalType.TIMESTAMP)
    private Date updatedAt;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "fidItemVentaId")
    private List<FidTareaItem> fidTareaItemList;
    @OneToOne(cascade = CascadeType.ALL, mappedBy = "fidItemVenta")
    private FidItemVentaImpresion fidItemVentaImpresion;
    @JoinColumn(name = "fid_pedido_venta_id", referencedColumnName = "id")
    @ManyToOne(optional = false)
    private FidPedidoVenta fidPedidoVentaId;
    @JoinColumn(name = "fid_producto_venta_id", referencedColumnName = "id")
    @ManyToOne(optional = false)
    private FidProductoVenta fidProductoVentaId;
    @JoinColumn(name = "fid_destino_producto_servicio_id", referencedColumnName = "id")
    @ManyToOne
    private FidDestinoProductoServicio fidDestinoProductoServicioId;

    public FidItemVenta() {
    }

    public FidItemVenta(Integer id) {
        this.id = id;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public Integer getCant() {
        return cant;
    }

    public void setCant(Integer cant) {
        this.cant = cant;
    }

    public String getDescripcion() {
        return descripcion;
    }

    public void setDescripcion(String descripcion) {
        this.descripcion = descripcion;
    }

    public Boolean getOferta() {
        return oferta;
    }

    public void setOferta(Boolean oferta) {
        this.oferta = oferta;
    }

    public String getTipo() {
        return tipo;
    }

    public void setTipo(String tipo) {
        this.tipo = tipo;
    }

    public Date getCreatedAt() {
        return createdAt;
    }

    public void setCreatedAt(Date createdAt) {
        this.createdAt = createdAt;
    }

    public Date getUpdatedAt() {
        return updatedAt;
    }

    public void setUpdatedAt(Date updatedAt) {
        this.updatedAt = updatedAt;
    }

    public List<FidTareaItem> getFidTareaItemList() {
        return fidTareaItemList;
    }

    public void setFidTareaItemList(List<FidTareaItem> fidTareaItemList) {
        this.fidTareaItemList = fidTareaItemList;
    }

    public FidItemVentaImpresion getFidItemVentaImpresion() {
        return fidItemVentaImpresion;
    }

    public void setFidItemVentaImpresion(FidItemVentaImpresion fidItemVentaImpresion) {
        this.fidItemVentaImpresion = fidItemVentaImpresion;
    }

    public FidPedidoVenta getFidPedidoVentaId() {
        return fidPedidoVentaId;
    }

    public void setFidPedidoVentaId(FidPedidoVenta fidPedidoVentaId) {
        this.fidPedidoVentaId = fidPedidoVentaId;
    }

    public FidProductoVenta getFidProductoVentaId() {
        return fidProductoVentaId;
    }

    public void setFidProductoVentaId(FidProductoVenta fidProductoVentaId) {
        this.fidProductoVentaId = fidProductoVentaId;
    }

    public FidDestinoProductoServicio getFidDestinoProductoServicioId() {
        return fidDestinoProductoServicioId;
    }

    public void setFidDestinoProductoServicioId(FidDestinoProductoServicio fidDestinoProductoServicioId) {
        this.fidDestinoProductoServicioId = fidDestinoProductoServicioId;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof FidItemVenta)) {
            return false;
        }
        FidItemVenta other = (FidItemVenta) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.jomijushi.fid.dominio.FidItemVenta[id=" + id + "]";
    }

}
